package chapter04;

public class Java26_Object {
    public static void main(String[] args) {
        // TODO 作用域
        User26 user = new User26();
        user.test();


    }
}
class Person26{
    // 父子类存在相同属性时，默认访问子类
    //public String name = "zhangsan";
    public static String name = "zhangsan"; // zhangsan

}
class User26 extends Person26{
    // 属性
    //public String name = "lisi";
    public static String name = "lisi"; // lisi

//    public void test(){
//        // 局部变量
//        //String name = "wangwu";
//        // 如果属性和（局部）变量得名称相同，访问时如果不加修饰符，那么优先访问变量
//        System.out.println(name);
//        System.out.println(this.name);
//        System.out.println(super.name);
//    }
    public static void test(){
        System.out.println(name);   // lisi
        System.out.println(Person26.name);  // zhangsan
        //System.out.println(super.name); 报错：'chapter04.User26.super' cannot be referenced from a static context
    }
}